package cate.game.pvp.eliterace.simulator;

import cate.game.pvp.eliterace.data.EliteRaceKV;
import cate.game.pvp.eliterace.data.EliteRaceRecord;
import cate.game.pvp.eliterace.handler.*;
import cate.game.pvp.eliterace.timer.EliteRaceTimerTask.Settings;

import java.util.List;
import java.util.function.Supplier;

import static cate.game.pvp.eliterace.util.EliteRaceSpecUtils.getTrialFlag;
import static cate.game.pvp.eliterace.util.EliteRaceSpecUtils.isMatchTrialSimulator;

public class BothEliteRaceTrialSimulator extends BaseEliteRaceBetSimulator {
    public BothEliteRaceTrialSimulator(Supplier<EliteRaceKV> kvSupplier,
                                       Supplier<EliteRaceRecordOperation> recordOperationSupplier,
                                       Supplier<EliteRacePsOperation> psOperationSupplier,
                                       Supplier<EliteRaceFightOperation> fightOperationSupplier,
                                       Supplier<EliteRaceRankRwdOperation> rankRwdOperationSupplier,
                                       Supplier<EliteRaceBetOperation> betOperationSupplier,
                                       Supplier<EliteRaceVideoOperation> videoOperationSupplier) {
        super(
                kvSupplier,
                recordOperationSupplier,
                psOperationSupplier,
                fightOperationSupplier,
                rankRwdOperationSupplier,
                betOperationSupplier,
                videoOperationSupplier
        );
    }

    @Override
    protected int getPeriodFlag(Settings settings) {
        return getTrialFlag(settings);
    }

    @Override
    protected List<EliteRaceRecord> query(Settings settings) {
        return getRecordOperation().query(settings.getSpec());
    }

    @Override
    public boolean isMatch(Settings settings) {
        return isMatchTrialSimulator(settings);
    }
}
